"""
打包配置文件
"""
from setuptools import setup, find_packages
import sys
# 显著增加递归深度限制
sys.setrecursionlimit(10000)

APP = ['main.py']
DATA_FILES = [
    ('', ['requirements.txt', 'README.md']),
    ('logs', []),
    ('output', [])
]
OPTIONS = {
    'argv_emulation': False,  # 禁用argv_emulation，避免加载Carbon框架
    'packages': ['pandas', 'PyQt6'],
    'iconfile': 'app_icon.icns',  # 需要添加图标文件
    'plist': {
        'CFBundleName': 'iOS崩溃堆栈解析工具',
        'CFBundleDisplayName': 'iOS崩溃堆栈解析工具',
        'CFBundleVersion': '0.1.0',
        'CFBundleShortVersionString': '0.1.0',
        'NSHumanReadableCopyright': 'Copyright © 2023',
        'NSPrincipalClass': 'NSApplication',
        'LSUIElement': False,  # 设置为False以显示Dock图标
        'LSBackgroundOnly': False,  # 设置为False以允许前台运行
    },
    # 添加排除项，排除导致递归错误的包和不必要的依赖
    'excludes': [
        'sympy', 'numpy.f2py', 'numpy.distutils', 'scipy', 'matplotlib', 
        'PyQt5', 'PySide2', 'PyQt6.QtWebEngineCore', 'PyQt6.QtWebEngineWidgets',
        'docutils', 'sphinx', 'PIL', 'lxml'
    ],
    # 使用alias模式，只创建应用程序启动器，不包含Python环境
    'alias': True,
}

setup(
    name='iOS崩溃堆栈解析工具',
    version='0.1.0',
    description='批量解析iOS崩溃堆栈信息的工具',
    author='',
    author_email='',
    url='',
    app=APP,
    data_files=DATA_FILES,
    options={'py2app': OPTIONS},
    setup_requires=['py2app'],
    packages=find_packages(),
    install_requires=[
        'pandas>=2.0.0',
        'PyQt6>=6.5.0',
        'tqdm>=4.65.0',
    ],
    classifiers=[
        'Development Status :: 3 - Alpha',
        'Environment :: MacOS X',
        'Environment :: X11 Applications :: Qt',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: MIT License',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.9',
        'Topic :: Software Development :: Quality Assurance',
    ],
) 